package com.trkj.dao.jpa;

import java.util.List;

import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.trkj.pojos.YzrMedicine;

public interface IYzrMedicineDAO extends CrudRepository<YzrMedicine, String> {
	
	//找出最大编号
	@Query("select max(m.medId) from YzrMedicine m where m.medId like ?1%")
    public String findID(String a);
	
	//分页查询
	@Query("select m from YzrMedicine m order by m.medId desc")
	public List<YzrMedicine> findAll(Pageable pageable);
	
	@Query("select m from YzrMedicine m order by m.medId desc")
	public List<YzrMedicine> findAllMedicine();
	
	//根据药品名称模糊查询药房
	@Query("select m from YzrMedicine m where m.medName like %?1%")
	public List<YzrMedicine> findByMedNameLike(String name);
		
	//根据药品类型模糊查询药房
	@Query("select m from YzrMedicine m where m.medKind like %?1%")
	public List<YzrMedicine> findByMedKindLike(String kind);
}
